#!/bin/bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $DIR/environment


$DIR/check
PACKAGE_PATH=$1

if [ $? -eq 0 ]; then
    docker-compose -p web-testing -f docker-compose.yml -f docker-compose.testing.yml run -w /polyaxon/${PACKAGE_PATH} web isort -rc --check-only .
    docker-compose -p web-testing -f docker-compose.yml -f docker-compose.testing.yml run -w /polyaxon/${PACKAGE_PATH} --no-deps web prospector -X polyaxon
    docker-compose -p web-testing -f docker-compose.yml -f docker-compose.testing.yml run -w /polyaxon/${PACKAGE_PATH} --no-deps web prospector -X tests
    docker-compose -p web-testing -f docker-compose.yml -f docker-compose.testing.yml run -w /polyaxon/${PACKAGE_PATH} web python3 polyaxon/manage.py check
fi
